home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / MPW_TOOL / TOOLS / TOOLS_WI / M4__ / HASH.M4 < prev    next >
Text File  |  1988-11-08  |  425b  |  18 lines

  1. dnl    This probably will not run on any m4 that cannot
  2. dnl    handle char constants in eval.
  3. dnl
  4. changequote(<,>) define(HASHVAL,99) dnl
  5. define(hash,<eval(str(substr($1,1),0)%HASHVAL)>) dnl
  6. define(str,
  7.     <ifelse($1,",$2,
  8.         <str(substr(<$1>,1),<eval($2+'substr($1,0,1)')>)>)
  9.     >) dnl
  10. define(KEYWORD,<$1,hash($1),>) dnl
  11. define(TSTART,
  12. <struct prehash {
  13.     char *keyword;
  14.     int   hashval;
  15. } keytab[] = {>) dnl
  16. define(TEND,<    "",0
  17. };>) dnl
  18.